
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>6.schema.xml dataHost · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="mycat简单入门demo.html" />
    
    
    <link rel="prev" href="vagrant_开发端口.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="linux_安装mysql.html">
            
                <a href="linux_安装mysql.html">
            
                    
                    1.CentOS7离线安装MySQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="mycat目录.html">
            
                <a href="mycat目录.html">
            
                    
                    2.mycat目录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="linux_安装mycat.html">
            
                <a href="linux_安装mycat.html">
            
                    
                    3.linux_安装mycat
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="mycat的端口.html">
            
                <a href="mycat的端口.html">
            
                    
                    3.mycat的端口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="linux切换语言.html">
            
                <a href="linux切换语言.html">
            
                    
                    4.linux切换语言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="vagrant_开发端口.html">
            
                <a href="vagrant_开发端口.html">
            
                    
                    5.vagrant_开发端口
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.8" data-path="schema_xml_dataHost.html">
            
                <a href="schema_xml_dataHost.html">
            
                    
                    6.schema.xml dataHost
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="mycat简单入门demo.html">
            
                <a href="mycat简单入门demo.html">
            
                    
                    7.mycat简单入门demo
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="读写分离.html">
            
                <a href="读写分离.html">
            
                    
                    8.读写分离
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="多个vagrant.html">
            
                <a href="多个vagrant.html">
            
                    
                    9.多个vagrant
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="mycat_router.html">
            
                <a href="mycat_router.html">
            
                    
                    10.mycat_router
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="mysql如何做到主从复制.html">
            
                <a href="mysql如何做到主从复制.html">
            
                    
                    11.mysql如何做到主从复制
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >6.schema.xml dataHost</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <pre><code>
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;!DOCTYPE mycat:schema SYSTEM &quot;schema.dtd&quot;&gt;
&lt;mycat:schema xmlns:mycat=&quot;http://org.opencloudb/&quot;&gt;

&lt;dataHost name=&quot;localhost1&quot; maxCon=&quot;1000&quot; minCon=&quot;10&quot; balance=&quot;0&quot; dbType=&quot;mysql&quot; dbDriver=&quot;jdbc&quot; writeType=&quot;0&quot; switchType=&quot;1&quot;  slaveThreshold=&quot;100&quot;&gt;
        &lt;heartbeat&gt;select user()&lt;/heartbeat&gt;
        &lt;writeHost host=&quot;hostM1&quot; url=&quot;jdbc:mysql://192.168.1.150:5029&quot; user=&quot;root&quot; password=&quot;root&quot;&gt;&lt;/writeHost&gt;
    &lt;/dataHost&gt;
</code></pre><pre><code>#dataHost&#x5C5E;&#x6027;
#name=&quot;localhost1&quot; 
#maxCon=&quot;1000&quot; minCon=&quot;10&quot; 
#balance=&quot;0&quot; 
#dbType=&quot;mysql&quot;
#dbDriver=&quot;jdbc&quot;
#writeType=&quot;0&quot;
</code></pre><h2 id="datahost&#x5C5E;&#x6027;">dataHost&#x5C5E;&#x6027;</h2>
<p>&#x54EA;&#x4E2A;&#x6570;&#x636E;&#x5E93;&#x5B9E;&#x4F8B;&#x7684;
&#x76F4;&#x63A5;&#x5B9A;&#x4E49;&#x4E86;&#x5177;&#x4F53;&#x7684;&#x6570;&#x636E;&#x5E93;&#x5B9E;&#x4F8B;&#x3001;&#x8BFB;&#x5199;&#x5206;&#x79BB;&#x914D;&#x7F6E;&#x5FC3;&#x8DF3;&#x8BED;&#x53E5;</p>
<h2 id="namelocalhost1">name=&quot;localhost1&quot;</h2>
<p>&#x552F;&#x4E00;&#x7684;&#x540D;&#x5B57;</p>
<h2 id="maxcon1000-mincon10">maxCon=&quot;1000&quot; minCon=&quot;10&quot;</h2>
<h2 id="balance&#x5C5E;&#x6027;">balance&#x5C5E;&#x6027;</h2>
<p>&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#x7C7B;&#x578B;&#xFF0C;&#x76EE;&#x524D;&#x7684;&#x53D6;&#x503C;&#x6709;3&#x79CD;&#xFF1A;</p>
<ol>
<li>balance=&#x201C;0&#x201D;, &#x6240;&#x6709;&#x8BFB;&#x64CD;&#x4F5C;&#x90FD;&#x53D1;&#x9001;&#x5230;&#x5F53;&#x524D;&#x53EF;&#x7528;&#x7684;writeHost&#x4E0A;&#x3002;</li>
<li>balance=&#x201C;1&#x201D;&#xFF0C;&#x6240;&#x6709;&#x8BFB;&#x64CD;&#x4F5C;&#x90FD;&#x968F;&#x673A;&#x7684;&#x53D1;&#x9001;&#x5230;readHost&#x3002;</li>
<li>balance=&#x201C;2&#x201D;&#xFF0C;&#x6240;&#x6709;&#x8BFB;&#x64CD;&#x4F5C;&#x90FD;&#x968F;&#x673A;&#x7684;&#x5728;writeHost&#x3001;readhost&#x4E0A;&#x5206;&#x53D1;&#x3002;</li>
</ol>
<h2 id="dbtype&#x5C5E;&#x6027;">dbType&#x5C5E;&#x6027;</h2>
<p>&#x6307;&#x5B9A;&#x540E;&#x7AEF;&#x8FDE;&#x63A5;&#x7684;&#x6570;&#x636E;&#x5E93;&#x7C7B;&#x578B;&#xFF0C;&#x76EE;&#x524D;&#x652F;&#x6301;&#x4E8C;&#x8FDB;&#x5236;&#x7684;mysql&#x534F;&#x8BAE;&#xFF0C;&#x8FD8;&#x6709;&#x5176;&#x4ED6;&#x4F7F;&#x7528;JDBC&#x8FDE;&#x63A5;&#x7684;&#x6570;&#x636E;&#x5E93;&#x3002;&#x4F8B;&#x5982;&#xFF1A;mongodb&#x3001;oracle&#x3001;</p>
<h2 id="dbdriver&#x5C5E;&#x6027;">dbDriver&#x5C5E;&#x6027;</h2>
<p>&#x6307;&#x5B9A;&#x8FDE;&#x63A5;&#x540E;&#x7AEF;&#x6570;&#x636E;&#x5E93;&#x4F7F;&#x7528;&#x7684;Driver&#xFF0C;&#x76EE;&#x524D;&#x53EF;&#x9009;&#x7684;&#x503C;&#x6709;native&#x548C;JDBC&#x3002;&#x4F7F;&#x7528;native&#x7684;&#x8BDD;&#xFF0C;&#x56E0;&#x4E3A;&#x8FD9;&#x4E2A;&#x503C;&#x6267;&#x884C;&#x7684;&#x662F;&#x4E8C;&#x8FDB;&#x5236;&#x7684;mysql&#x534F;
&#x8BAE;&#xFF0C;&#x6240;&#x4EE5;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;mysql&#x548C;maridb&#x3002;&#x5176;&#x4ED6;&#x7C7B;&#x578B;&#x7684;&#x6570;&#x636E;&#x5E93;&#x5219;&#x9700;&#x8981;&#x4F7F;&#x7528;JDBC&#x9A71;&#x52A8;&#x6765;&#x652F;&#x6301;&#x3002;
&#x5982;&#x679C;&#x4F7F;&#x7528;JDBC&#x7684;&#x8BDD;&#x9700;&#x8981;&#x5C06;&#x7B26;&#x5408;JDBC 4&#x6807;&#x51C6;&#x7684;&#x9A71;&#x52A8;JAR&#x5305;&#x653E;&#x5230;MYCAT\lib&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x5E76;&#x68C0;&#x67E5;&#x9A71;&#x52A8;JAR&#x5305;&#x4E2D;&#x5305;&#x62EC;&#x5982;&#x4E0B;&#x76EE;&#x5F55;&#x7ED3;&#x6784;&#x7684;&#x6587;
&#x4EF6;&#xFF1A;META-INF\services\java.sql.Driver&#x3002;&#x5728;&#x8FD9;&#x4E2A;&#x6587;&#x4EF6;&#x5185;&#x5199;&#x4E0A;&#x5177;&#x4F53;&#x7684;Driver&#x7C7B;&#x540D;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;com.mysql.jdbc.Driver&#x3002;</p>
<h2 id="writetype&#x5C5E;&#x6027;">writeType&#x5C5E;&#x6027;</h2>
<p>&#x8D1F;&#x8F7D;&#x5747;&#x8861;&#x7C7B;&#x578B;&#xFF0C;&#x76EE;&#x524D;&#x7684;&#x53D6;&#x503C;&#x6709;3&#x79CD;&#xFF1A;</p>
<ol>
<li>writeType=&#x201C;0&#x201D;, &#x6240;&#x6709;&#x5199;&#x64CD;&#x4F5C;&#x90FD;&#x53D1;&#x9001;&#x5230;&#x53EF;&#x7528;&#x7684;writeHost&#x4E0A;&#x3002;</li>
<li>writeType=&#x201C;1&#x201D;&#xFF0C;&#x6240;&#x6709;&#x5199;&#x64CD;&#x4F5C;&#x90FD;&#x968F;&#x673A;&#x7684;&#x53D1;&#x9001;&#x5230;readHost&#x3002;</li>
<li>writeType=&#x201C;2&#x201D;&#xFF0C;&#x6240;&#x6709;&#x5199;&#x64CD;&#x4F5C;&#x90FD;&#x968F;&#x673A;&#x7684;&#x5728;writeHost&#x3001;readhost&#x5206;&#x4E0A;&#x53D1;&#x3002;</li>
</ol>
<pre><code>&lt;writeHost host=&quot;hostM1&quot; url=&quot;jdbc:mysql://192.168.1.150:5029&quot; user=&quot;root&quot; password=&quot;root&quot;&gt;&lt;/writeHost&gt;
</code></pre><pre><code>writeHost  readHost&#x6807;&#x7B7E;
&#x8FD9;&#x4E24;&#x4E2A;&#x6807;&#x7B7E;&#x90FD;&#x6307;&#x5B9A;&#x540E;&#x7AEF;&#x6570;&#x636E;&#x5E93;&#x7684;&#x76F8;&#x5173;&#x914D;&#x7F6E;&#x7ED9;mycat&#xFF0C;&#x7528;&#x4E8E;&#x5B9E;&#x4F8B;&#x5316;&#x540E;&#x7AEF;&#x8FDE;&#x63A5;&#x6C60;&#x3002;&#x552F;&#x4E00;&#x4E0D;&#x540C;&#x7684;&#x662F;&#xFF0C;writeHost&#x6307;&#x5B9A;&#x5199;&#x5B9E;&#x4F8B;&#x3001;readHost
&#x6307;&#x5B9A;&#x8BFB;&#x5B9E;&#x4F8B;&#xFF0C;&#x7EC4;&#x7740;&#x8FD9;&#x4E9B;&#x8BFB;&#x5199;&#x5B9E;&#x4F8B;&#x6765;&#x6EE1;&#x8DB3;&#x7CFB;&#x7EDF;&#x7684;&#x8981;&#x6C42;&#x3002;

host
host&#x5C5E;&#x6027;
&#x7528;&#x4E8E;&#x6807;&#x8BC6;&#x4E0D;&#x540C;&#x5B9E;&#x4F8B;&#xFF0C;&#x4E00;&#x822C;writeHost&#x6211;&#x4EEC;&#x4F7F;&#x7528;*M1&#xFF0C;readHost&#x6211;&#x4EEC;&#x7528;*S1&#x3002;


url
&#x540E;&#x7AEF;&#x5B9E;&#x4F8B;&#x8FDE;&#x63A5;&#x5730;&#x5740;&#xFF0C;&#x5982;&#x679C;&#x662F;&#x4F7F;&#x7528;native&#x7684;dbDriver&#xFF0C;&#x5219;&#x4E00;&#x822C;&#x4E3A;address:port&#x8FD9;&#x79CD;&#x5F62;&#x5F0F;&#x3002;&#x7528;JDBC&#x6216;&#x5176;&#x4ED6;&#x7684;dbDriver&#xFF0C;&#x5219;&#x9700;&#x8981;&#x7279;&#x6B8A;

user&#x5C5E;&#x6027;
&#x540E;&#x7AEF;&#x5B58;&#x50A8;&#x5B9E;&#x4F8B;&#x9700;&#x8981;&#x7684;&#x7528;&#x6237;&#x540D;&#x5B57;

password&#x5C5E;&#x6027;
&#x540E;&#x7AEF;&#x5B58;&#x50A8;&#x5B9E;&#x4F8B;&#x9700;&#x8981;&#x7684;&#x5BC6;&#x7801;
</code></pre>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="vagrant_开发端口.html" class="navigation navigation-prev " aria-label="Previous page: 5.vagrant_开发端口">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="mycat简单入门demo.html" class="navigation navigation-next " aria-label="Next page: 7.mycat简单入门demo">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"6.schema.xml dataHost","level":"1.8","depth":1,"next":{"title":"7.mycat简单入门demo","level":"1.9","depth":1,"path":"mycat简单入门demo.md","ref":"./mycat简单入门demo.md","articles":[]},"previous":{"title":"5.vagrant_开发端口","level":"1.7","depth":1,"path":"vagrant_开发端口.md","ref":"./vagrant_开发端口.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"schema_xml_dataHost.md","mtime":"2018-07-21T08:37:07.790Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-07-23T06:58:37.163Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

